<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        class Person{
            name;
            age;
            get name(){
                return name
            }
            set name(name){
                this.name=name
            }
            eat(food){
                console.log(`${this.age}${this.name}吃`+food);
                
            }
            constructor(name,age){
                this.name=name
                this.age=age
            }
        }
        let person =new Person("小米",12)
        console.log(person);
        person.eat("火锅")
        
    </script>
</head>
<body>
    
</body>
</html>